home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIStringStream.idl < prev    next >
Text File  |  2006-05-08  |  5KB  |  132 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *   mcmullen@netscape.com (original author)
  24.  *   scc@mozilla.org
  25.  *   davidm@netscape.com
  26.  *   darin@netscape.com
  27.  *
  28.  * Alternatively, the contents of this file may be used under the terms of
  29.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  30.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  31.  * in which case the provisions of the GPL or the LGPL are applicable instead
  32.  * of those above. If you wish to allow use of your version of this file only
  33.  * under the terms of either the GPL or the LGPL, and not to allow others to
  34.  * use your version of this file under the terms of the MPL, indicate your
  35.  * decision by deleting the provisions above and replace them with the notice
  36.  * and other provisions required by the GPL or the LGPL. If you do not delete
  37.  * the provisions above, a recipient may use your version of this file under
  38.  * the terms of any one of the MPL, the GPL or the LGPL.
  39.  *
  40.  * ***** END LICENSE BLOCK ***** */
  41.  
  42. /**
  43.  * Based on original code from nsIStringStream.h
  44.  */
  45.  
  46. #include "nsIInputStream.idl"
  47.  
  48. /**
  49.  * nsIStringInputStream
  50.  *
  51.  * Provides scriptable and specialized C++ only methods for initializing a
  52.  * nsIInputStream implementation with a simple character array.
  53.  */
  54. [scriptable, uuid(450cd2d4-f0fd-424d-b365-b1251f80fd53)]
  55. interface nsIStringInputStream : nsIInputStream
  56. {
  57.     /**
  58.      * SetData - assign data to the input stream (copied on assignment).
  59.      *
  60.      * @param data    - stream data
  61.      * @param dataLen - stream data length (-1 if length should be computed)
  62.      *
  63.      * NOTE: C++ code should consider using AdoptData or ShareData to avoid
  64.      * making an extra copy of the stream data.
  65.      */
  66.     void setData(in string data, in long dataLen);
  67.  
  68.     /**
  69.      * NOTE: the following methods are designed to give C++ code added control
  70.      * over the ownership and lifetime of the stream data.  Use with care :-)
  71.      */
  72.  
  73.     /**
  74.      * AdoptData - assign data to the input stream.  the input stream takes
  75.      * ownership of the given data buffer and will nsMemory::Free it when
  76.      * the input stream is destroyed.
  77.      *
  78.      * @param data      - stream data
  79.      * @param dataLen   - stream data length (-1 if length should be computed)
  80.      */
  81.     [noscript] void adoptData(in charPtr data, in long dataLen);
  82.  
  83.     /**
  84.      * ShareData - assign data to the input stream.  the input stream references
  85.      * the given data buffer until the input stream is destroyed.  the given
  86.      * data buffer must outlive the input stream.
  87.      *
  88.      * @param data      - stream data
  89.      * @param dataLen   - stream data length (-1 if length should be computed)
  90.      */
  91.     [noscript] void shareData(in string data, in long dataLen);
  92. };
  93.  
  94. %{C++
  95.  
  96. //-----------------------------------------------------------------------------
  97. // C++ factory methods
  98. //-----------------------------------------------------------------------------
  99.  
  100. #include "nsIInputStream.h"
  101. #include "nsString.h"
  102.  
  103. //-----------------------------------------------------------------------------
  104. // Factory method to get an nsInputStream from an nsAString.  Result will
  105. // implement nsIStringInputStream and nsISeekableStream
  106. extern "C" NS_COM nsresult
  107. NS_NewStringInputStream(nsIInputStream** aStreamResult,
  108.                         const nsAString& aStringToRead);
  109.  
  110. //-----------------------------------------------------------------------------
  111. // Factory method to get an nsInputStream from an nsACString.  Result will
  112. // implement nsIStringInputStream and nsISeekableStream 
  113. extern "C" NS_COM nsresult
  114. NS_NewCStringInputStream(nsIInputStream** aStreamResult,
  115.                          const nsACString& aStringToRead);
  116.  
  117. //-----------------------------------------------------------------------------
  118. // Factory method to get an nsInputStream from a string.  Result will
  119. // implement nsIStringInputStream and nsISeekableStream
  120. extern "C" NS_COM nsresult
  121. NS_NewCharInputStream(nsIInputStream** aStreamResult,
  122.                       const char* aStringToRead);
  123.  
  124. //-----------------------------------------------------------------------------
  125. // Factory method to get an nsInputStream from a byte buffer.  Result will
  126. // implement nsIStringInputStream and nsISeekableStream
  127. extern "C" NS_COM nsresult
  128. NS_NewByteInputStream(nsIInputStream** aStreamResult,
  129.                       const char* aStringToRead,
  130.                       PRInt32 aLength);
  131. %}
  132.